package org.chs.ts.batch.execute.daily;


import lombok.extern.slf4j.Slf4j;
import org.chs.ts.base.batch.vo.entity.BatchDailyExecResp;
import org.chs.ts.batch.execute.BatchDailyTaskExecute;
import org.chs.ts.batch.threadservice.BatchStepServiceBase;
import org.chs.ts.batch.util.CommonUtil;
import org.chs.ts.batch.exception.TaskDailyException;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;

/**
 * @Compay 盛唐天行
 * @Author: wuwei
 * @Censor By wuwei
 * @Sence 2024/6/27 15:09
 * @Modify 2024/6/27 15:09
 * @Description
 */
@Slf4j
@Service("DailyTaskExecuteDemo")
@Lazy
public class DailyTaskExecuteDemo implements BatchStepServiceBase<BatchDailyTaskExecute, BatchDailyExecResp, TaskDailyException> {
    @Override
    public BatchDailyExecResp execute(BatchDailyTaskExecute batchServiceBean) {

        printRunningMsg(batchServiceBean);
        BatchDailyExecResp resp = batchServiceBean.initBatchExecResp();

        return resp;
    }

    @Override
    public void rollback(BatchDailyTaskExecute BatchServiceBean) throws TaskDailyException {

    }

    @Override
    public void printRunningMsg(BatchDailyTaskExecute batchServiceBean) {
        // 输出 运行参数信息
        CommonUtil.showRunningMsg(this.getClass().getSimpleName(), "execute", batchServiceBean.getTaskParams(), batchServiceBean.getTaskStepParams());
        // 当前方法 在 未启用 taskParams 和 taskStepParams 调用
        CommonUtil.invalidParamMsg(this.getClass().getSimpleName(), "execute", batchServiceBean.getTaskParams(),
                batchServiceBean.getTaskStepParams());
    }
}
